Calendar All Tests
Current file: /home/estudydev/workspace/eStudy_svn/web/roleplay/classes/class.rolesetlist.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 6
0.00 %0.00%
0.00% 0 / 112
 
RoleSetList
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 6
0.00 %0.00%
0.00% 0 / 112
 public function listRoleSets($courseID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 43
 public function getRoleSets($courseID, $onlyActive = false)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 16
 public function countRoleSets($courseID, $onlyActive = false)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 9
 public function roleplayForced($courseID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 5
 public function forceRoleplay($courseID, $force)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 29
 public function showForceRoleplayForm($courseID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 10


       1                 : <?php                                                                                                                                                                                                                                                                                                                                                                                                                                                 
       2                 : /*--------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                         
       3                 : This file is part of eStudy.                                                                                                                                                                                                                                                                                                                                                                                                                          
       4                 : roleplay/classes/class.rolesetlist.inc.php                                                                                                                                                                                                                                                                                                                                                                                                            
       5                 : - Modulgruppe:  Roleplay                                                                                                                                                                                                                                                                                                                                                                                                                              
       6                 : - Beschreibung: Klasse zum Auflisten von Rollensets in Kursen.                                                                                                                                                                                                                                                                                                                                                                                        
       7                 : - Version:      0.6, 25/09/06                                                                                                                                                                                                                                                                                                                                                                                                                         
       8                 : - Autor(en):    Clemens Weiß <clemens.weiss@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                       
       9                 : +---------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                         
      10                 : This program is free software; you can redistribute it and/or                                                                                                                                                                                                                                                                                                                                                                                         
      11                 : modify it under the terms of the GNU General Public License                                                                                                                                                                                                                                                                                                                                                                                           
      12                 : as published by the Free Software Foundation; either version 2                                                                                                                                                                                                                                                                                                                                                                                        
      13                 : of the License, or any later version.                                                                                                                                                                                                                                                                                                                                                                                                                 
      14                 : +---------------------------------------------------------------------------+                                                                                                                                                                                                                                                                                                                                                                         
      15                 : This program is distributed in the hope that it will be useful,                                                                                                                                                                                                                                                                                                                                                                                       
      16                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                                                                                                                                                                                                                                                                                                                                                        
      17                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                                                                                                                                                                                                                                                                                                                                                         
      18                 : GNU General Public License for more details.                                                                                                                                                                                                                                                                                                                                                                                                          
      19                 : You should have received a copy of the GNU General Public License                                                                                                                                                                                                                                                                                                                                                                                     
      20                 : along with this program; if not, write to the Free Software                                                                                                                                                                                                                                                                                                                                                                                           
      21                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                                                                                                                                                                                                                                                                                                                                                           
      22                 : +--------------------------------------------------------------------------*/                                                                                                                                                                                                                                                                                                                                                                         
      23                 : /**                                                                                                                                                                                                                                                                                                                                                                                                                                                   
      24                 :  * Klasse zum Auflisten von Rollensets in Kursen.                                                                                                                                                                                                                                                                                                                                                                                                     
      25                 :  * @package eStudy.Roleplay                                                                                                                                                                                                                                                                                                                                                                                                                           
      26                 :  * @version 0.6, 25/09/06                                                                                                                                                                                                                                                                                                                                                                                                                             
      27                 :  * @author Clemens Weiß <clemens.weiss@mni.fh-giessen.de>                                                                                                                                                                                                                                                                                                                                                                                            
      28                 :  */                                                                                                                                                                                                                                                                                                                                                                                                                                                   
      29                 : require_once (PATH_TO_ROOT."roleplay/classes/class.roleset.inc.php");                                                                                                                                                                                                                                                                                                                                                                                 
      30                 : require_once (PATH_TO_ROOT."roleplay/classes/class.userrolemanagement.inc.php");                                                                                                                                                                                                                                                                                                                                                                      
      31                 : require_once (PATH_TO_ROOT."courses/classes/class.Course.inc.php");                                                                                                                                                                                                                                                                                                                                                                                   
      32                 : class RoleSetList {                                                                                                                                                                                                                                                                                                                                                                                                                                   
      33                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                               
      34                 :      * Listet alle für den Kurs/im Foyer verfügbaren Rollenspiel-Vorlagen auf.                                                                                                                                                                                                                                                                                                                                                                      
      35                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                
      36                 :      * @static                                                                                                                                                                                                                                                                                                                                                                                                                                        
      37                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                 
      38                 :      * @param int $courseID ID des Kurses (0 für Foyer)                                                                                                                                                                                                                                                                                                                                                                                              
      39                 :      * @return bool false bei falscher Kurs-ID, sonst true                                                                                                                                                                                                                                                                                                                                                                                            
      40                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                               
      41                 :     function listRoleSets($courseID) {                                                                                                                                                                                                                                                                                                                                                                                                                
      42               0 :         if (!is_integer($courseID) || $courseID < 0) {                                                                                                                                                                                                                                                                                                                                                                                                
      43               0 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                             
      44                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
      45               0 :         if ($courseID == 0) {                                                                                                                                                                                                                                                                                                                                                                                                                         
      46               0 :             $title = "Global verf&uuml;gbare Vorlagen";                                                                                                                                                                                                                                                                                                                                                                                               
      47               0 :         } else {                                                                                                                                                                                                                                                                                                                                                                                                                                      
      48               0 :             $title = "In diesem Kurs verf&uuml;gbare Vorlagen";                                                                                                                                                                                                                                                                                                                                                                                       
      49                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
      50               0 :         if ($courseID == 0 && $_SESSION["course"] > 0) {                                                                                                                                                                                                                                                                                                                                                                                              
      51                 :             // In Kursen keine inaktiven Sets aus dem Foyer anzeigen                                                                                                                                                                                                                                                                                                                                                                                  
      52               0 :             $sets = RoleSetList::getRoleSets($courseID, true);                                                                                                                                                                                                                                                                                                                                                                                        
      53               0 :         } else {                                                                                                                                                                                                                                                                                                                                                                                                                                      
      54               0 :             $sets = RoleSetList::getRoleSets($courseID);                                                                                                                                                                                                                                                                                                                                                                                              
      55                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
      56               0 :         echo "<table class='contentTable roleSetListing'>\n";                                                                                                                                                                                                                                                                                                                                                                                         
      57               0 :         Output::echoTableHead($title, 5);                                                                                                                                                                                                                                                                                                                                                                                                             
      58               0 :         echo "<tr><th>Name</th>"."<th>Rollen</th>"."<th>Autor</th>"."<th>Erstellt am</th>"."<th>Aktionen</th></tr>\n";                                                                                                                                                                                                                                                                                                                                
      59               0 :         if (count($sets)) {                                                                                                                                                                                                                                                                                                                                                                                                                           
      60               0 :             foreach($sets as $set) {                                                                                                                                                                                                                                                                                                                                                                                                                  
      61               0 :                 echo "<tr valign='top'><td>".Data::toHTML($set->getName(), false) ."</td><td>";                                                                                                                                                                                                                                                                                                                                                       
      62               0 :                 if (count($set->getRoles())) {                                                                                                                                                                                                                                                                                                                                                                                                        
      63               0 :                     echo "<ul>";                                                                                                                                                                                                                                                                                                                                                                                                                      
      64               0 :                     foreach($set->getRoles() as $role) {                                                                                                                                                                                                                                                                                                                                                                                              
      65               0 :                         echo "<li>".Data::toHTML($role->getName(), false) ."</li>";                                                                                                                                                                                                                                                                                                                                                                   
      66               0 :                     }                                                                                                                                                                                                                                                                                                                                                                                                                                 
      67               0 :                     echo "</ul>";                                                                                                                                                                                                                                                                                                                                                                                                                     
      68               0 :                 } else {                                                                                                                                                                                                                                                                                                                                                                                                                              
      69               0 :                     echo "Noch keine Rollen definiert.";                                                                                                                                                                                                                                                                                                                                                                                              
      70                 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                     
      71               0 :                 echo "</td><td>".Data::toHTML($set->getAuthor(), false) ."</td>"."<td>".Output::echoDate("d.m.Y", $set->getDate()) ."</td>"."<td>";                                                                                                                                                                                                                                                                                                   
      72               0 :                 if ($courseID == 0 && $_SESSION["course"] > 0) {                                                                                                                                                                                                                                                                                                                                                                                      
      73               0 :                     echo "<a href='".PATH_TO_ROOT.SCRIPT_NAME."?action=takeSet&amp;ID=".$set->getID() ."'>&Uuml;bernehmen</a>";                                                                                                                                                                                                                                                                                                                       
      74               0 :                 } elseif ($_SESSION["course"] == $set->getCourseID()) {                                                                                                                                                                                                                                                                                                                                                                               
      75               0 :                     echo "<a href='".PATH_TO_ROOT.SCRIPT_NAME."?action=editSet&amp;ID=".$set->getID() ."'>".Output::getIcon("icon_edit", "Set bearbeiten") ."</a>"."<a href='".PATH_TO_ROOT.SCRIPT_NAME."?action=deleteSet&amp;ID=".$set->getID() ."'>".Output::getIcon("icon_muell", "Set löschen") ."</a>"."<a href='".PATH_TO_ROOT."roleplay/editroles.php?setID=".$set->getID() ."'>".Output::getIcon("icon_maske", "Rollen bearbeiten") ."</a>";
      76               0 :                     if ($courseID > 0) {                                                                                                                                                                                                                                                                                                                                                                                                              
      77               0 :                         if ($set->isActive()) {                                                                                                                                                                                                                                                                                                                                                                                                       
      78               0 :                             echo "<a href='".PATH_TO_ROOT.SCRIPT_NAME."?action=deactivateSet&amp;ID=".$set->getID() ."'>".Output::getIcon("icon_schloss_zu", "Rollen-Set nicht mehr verwenden") ."</a>";                                                                                                                                                                                                                                              
      79               0 :                         } else {                                                                                                                                                                                                                                                                                                                                                                                                                      
      80               0 :                             echo "<a href='".PATH_TO_ROOT.SCRIPT_NAME."?action=activateSet&amp;ID=".$set->getID() ."'>".Output::getIcon("icon_schloss_auf", "Rollen-Set verwenden") ."</a>";                                                                                                                                                                                                                                                          
      81                 :                         }                                                                                                                                                                                                                                                                                                                                                                                                                             
      82               0 :                         echo "<br /><a href='".PATH_TO_ROOT.SCRIPT_NAME."?action=publishSet&amp;ID=".$set->getID() ."'>Ver&ouml;ffentlichen</a>";                                                                                                                                                                                                                                                                                                     
      83               0 :                     }                                                                                                                                                                                                                                                                                                                                                                                                                                 
      84               0 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                     
      85               0 :                 echo "</td></tr>\n";                                                                                                                                                                                                                                                                                                                                                                                                                  
      86               0 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                         
      87               0 :         } else {                                                                                                                                                                                                                                                                                                                                                                                                                                      
      88               0 :             echo "<tr><td colspan='5'>Es wurden noch keine Vorlagen angelegt.</td></tr>\n";                                                                                                                                                                                                                                                                                                                                                           
      89                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
      90               0 :         echo "</table>\n";                                                                                                                                                                                                                                                                                                                                                                                                                            
      91               0 :         return true;                                                                                                                                                                                                                                                                                                                                                                                                                                  
      92                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      93                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                               
      94                 :      * Gibt ein Array mit RoleSet-Objekten für den angegebenen Kurs zurück.                                                                                                                                                                                                                                                                                                                                                                         
      95                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                
      96                 :      * @static                                                                                                                                                                                                                                                                                                                                                                                                                                        
      97                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                 
      98                 :      * @param int $courseID ID des Kurses (0 für Foyer)                                                                                                                                                                                                                                                                                                                                                                                              
      99                 :      * @param bool $onlyActive Wenn true, werden nur aktive Rollen-Sets zurückgegeben                                                                                                                                                                                                                                                                                                                                                                
     100                 :      * @return mixed false, wenn die Kurs-ID ungültig ist, sonst ein Array mit RoleSet-Objekten                                                                                                                                                                                                                                                                                                                                                      
     101                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                               
     102                 :     function getRoleSets($courseID, $onlyActive = false) {                                                                                                                                                                                                                                                                                                                                                                                            
     103               0 :         global $db, $settings;                                                                                                                                                                                                                                                                                                                                                                                                                        
     104               0 :         $dbp = $settings["dbPrefix"];                                                                                                                                                                                                                                                                                                                                                                                                                 
     105               0 :         if (!is_integer($courseID) || $courseID < 0) {                                                                                                                                                                                                                                                                                                                                                                                                
     106               0 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                             
     107                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     108               0 :         $whereActive = "";                                                                                                                                                                                                                                                                                                                                                                                                                            
     109               0 :         if ($onlyActive) {                                                                                                                                                                                                                                                                                                                                                                                                                            
     110               0 :             $whereActive.= " AND is_active='1'";                                                                                                                                                                                                                                                                                                                                                                                                      
     111               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     112               0 :         $templates = array();                                                                                                                                                                                                                                                                                                                                                                                                                         
     113               0 :         $templateIDs = $db->get_col("SELECT id FROM {$dbp}rolesets WHERE course_id='$courseID'$whereActive ORDER BY name");                                                                                                                                                                                                                                                                                                                           
     114               0 :         if (!empty($templateIDs)) {                                                                                                                                                                                                                                                                                                                                                                                                                   
     115               0 :             foreach($templateIDs as $templateID) {                                                                                                                                                                                                                                                                                                                                                                                                    
     116               0 :                 $templates[] = new RoleSet((int)$templateID);                                                                                                                                                                                                                                                                                                                                                                                         
     117               0 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                         
     118               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     119               0 :         return $templates;                                                                                                                                                                                                                                                                                                                                                                                                                            
     120                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     121                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                               
     122                 :      * Gibt die Anzahl der Rollen-Sets für den angegebenen Kurs zurück                                                                                                                                                                                                                                                                                                                                                                              
     123                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                
     124                 :      * @static                                                                                                                                                                                                                                                                                                                                                                                                                                        
     125                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                 
     126                 :      * @param int $courseID ID des Kurses (0 für Foyer)                                                                                                                                                                                                                                                                                                                                                                                              
     127                 :      * @param bool $onlyActive Wenn true, werden nur aktive Rollen-Sets gezählt                                                                                                                                                                                                                                                                                                                                                                      
     128                 :      * @return mixed int Anzahl der Rollen-Sets oder false bei ungültiger Kurs-ID                                                                                                                                                                                                                                                                                                                                                                    
     129                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                               
     130                 :     function countRoleSets($courseID, $onlyActive = false) {                                                                                                                                                                                                                                                                                                                                                                                          
     131               0 :         global $db, $settings;                                                                                                                                                                                                                                                                                                                                                                                                                        
     132               0 :         $dbp = $settings["dbPrefix"];                                                                                                                                                                                                                                                                                                                                                                                                                 
     133               0 :         if (!is_integer($courseID) || $courseID < 0) {                                                                                                                                                                                                                                                                                                                                                                                                
     134               0 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                             
     135                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     136               0 :         $whereActive = "";                                                                                                                                                                                                                                                                                                                                                                                                                            
     137               0 :         if ($onlyActive) {                                                                                                                                                                                                                                                                                                                                                                                                                            
     138               0 :             $whereActive = "AND is_active='1'";                                                                                                                                                                                                                                                                                                                                                                                                       
     139               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     140               0 :         return (int)$db->get_var("SELECT COUNT(*) FROM {$dbp}rolesets WHERE course_id='$courseID' $whereActive");                                                                                                                                                                                                                                                                                                                                     
     141                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     142                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                               
     143                 :      * Gibt zurück, ob im angegebenen Kurs die Rolleneinnahme erzwungen wird.                                                                                                                                                                                                                                                                                                                                                                        
     144                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                
     145                 :      * @static                                                                                                                                                                                                                                                                                                                                                                                                                                        
     146                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                 
     147                 :      * @param int $courseID ID des Kurses                                                                                                                                                                                                                                                                                                                                                                                                             
     148                 :      * @return bool true bei Zwangsrollen, sonst false                                                                                                                                                                                                                                                                                                                                                                                                
     149                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                               
     150                 :     function roleplayForced($courseID) {                                                                                                                                                                                                                                                                                                                                                                                                              
     151               0 :         global $db, $settings;                                                                                                                                                                                                                                                                                                                                                                                                                        
     152               0 :         $dbp = $settings["dbPrefix"];                                                                                                                                                                                                                                                                                                                                                                                                                 
     153               0 :         if (!is_integer($courseID) || $courseID < 0) {                                                                                                                                                                                                                                                                                                                                                                                                
     154               0 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                             
     155                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     156               0 :         return (bool)$db->get_var("SELECT force_roles FROM {$dbp}courses WHERE ID='$courseID'");                                                                                                                                                                                                                                                                                                                                                      
     157                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     158                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                               
     159                 :      * Speichert, ob im angegebenen Kurs die Rolleneinnahme erzwungen wird.                                                                                                                                                                                                                                                                                                                                                                           
     160                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                
     161                 :      * @static                                                                                                                                                                                                                                                                                                                                                                                                                                        
     162                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                 
     163                 :      * @param int $courseID ID des Kurses                                                                                                                                                                                                                                                                                                                                                                                                             
     164                 :      * @param bool $force true bei Zwangsrollen, sonst false                                                                                                                                                                                                                                                                                                                                                                                          
     165                 :      * @return bool Erfolgswert                                                                                                                                                                                                                                                                                                                                                                                                                       
     166                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                               
     167                 :     function forceRoleplay($courseID, $force) {                                                                                                                                                                                                                                                                                                                                                                                                       
     168               0 :         global $db, $settings, $EZSQL_ERROR;                                                                                                                                                                                                                                                                                                                                                                                                          
     169               0 :         $dbp = $settings["dbPrefix"];                                                                                                                                                                                                                                                                                                                                                                                                                 
     170               0 :         if (!is_integer($courseID) || $courseID < 0 || !is_bool($force)) {                                                                                                                                                                                                                                                                                                                                                                            
     171               0 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                             
     172                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     173               0 :         $errorCount = count($EZSQL_ERROR);                                                                                                                                                                                                                                                                                                                                                                                                            
     174               0 :         if ($force && !RoleSetList::roleplayForced($courseID)) {                                                                                                                                                                                                                                                                                                                                                                                      
     175               0 :             $db->query("UPDATE {$dbp}courses SET force_roles=1");                                                                                                                                                                                                                                                                                                                                                                                     
     176               0 :             $users = Course::getParticipants($courseID, "all", "user.Nachname, user.Vorname");                                                                                                                                                                                                                                                                                                                                                        
     177               0 :             if (is_array($users) && !empty($users)) {                                                                                                                                                                                                                                                                                                                                                                                                 
     178               0 :                 $urm = new UserRoleManagement($courseID);                                                                                                                                                                                                                                                                                                                                                                                             
     179               0 :                 foreach($users as $user) {                                                                                                                                                                                                                                                                                                                                                                                                            
     180               0 :                     $roles = $urm->getRolesOfUser((int)$user->userid);                                                                                                                                                                                                                                                                                                                                                                                
     181               0 :                     $active = false;                                                                                                                                                                                                                                                                                                                                                                                                                  
     182               0 :                     $lastRoleID = 0;                                                                                                                                                                                                                                                                                                                                                                                                                  
     183               0 :                     foreach($roles as $roleID => $role) {                                                                                                                                                                                                                                                                                                                                                                                             
     184               0 :                         if ($role["isActive"]) {                                                                                                                                                                                                                                                                                                                                                                                                      
     185               0 :                             $active = true;                                                                                                                                                                                                                                                                                                                                                                                                           
     186               0 :                             break;                                                                                                                                                                                                                                                                                                                                                                                                                    
     187                 :                         }                                                                                                                                                                                                                                                                                                                                                                                                                             
     188               0 :                         $lastRoleID = $roleID;                                                                                                                                                                                                                                                                                                                                                                                                        
     189               0 :                     }                                                                                                                                                                                                                                                                                                                                                                                                                                 
     190               0 :                     if (!$active && $lastRoleID > 0) {                                                                                                                                                                                                                                                                                                                                                                                                
     191               0 :                         $urm->setActiveUserRole((int)$user->userid, $lastRoleID);                                                                                                                                                                                                                                                                                                                                                                     
     192               0 :                     }                                                                                                                                                                                                                                                                                                                                                                                                                                 
     193               0 :                 }                                                                                                                                                                                                                                                                                                                                                                                                                                     
     194               0 :             }                                                                                                                                                                                                                                                                                                                                                                                                                                         
     195               0 :         } elseif (!$force) {                                                                                                                                                                                                                                                                                                                                                                                                                          
     196               0 :             $db->query("UPDATE {$dbp}courses SET force_roles=0");                                                                                                                                                                                                                                                                                                                                                                                     
     197               0 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     198               0 :         return count($EZSQL_ERROR) == $errorCount;                                                                                                                                                                                                                                                                                                                                                                                                    
     199                 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     200                 :     /**                                                                                                                                                                                                                                                                                                                                                                                                                                               
     201                 :      * Gibt das Formular aus, mit dem die Rolleneinnahme erzwungen werden kann.                                                                                                                                                                                                                                                                                                                                                                       
     202                 :      *                                                                                                                                                                                                                                                                                                                                                                                                                                                
     203                 :      * @static                                                                                                                                                                                                                                                                                                                                                                                                                                        
     204                 :      * @access public                                                                                                                                                                                                                                                                                                                                                                                                                                 
     205                 :      * @param int $courseID ID des Kurses                                                                                                                                                                                                                                                                                                                                                                                                             
     206                 :      * @return void                                                                                                                                                                                                                                                                                                                                                                                                                                   
     207                 :      */                                                                                                                                                                                                                                                                                                                                                                                                                                               
     208                 :     function showForceRoleplayForm($courseID) {                                                                                                                                                                                                                                                                                                                                                                                                       
     209               0 :         if (!is_integer($courseID) || $courseID < 0) {                                                                                                                                                                                                                                                                                                                                                                                                
     210               0 :             return false;                                                                                                                                                                                                                                                                                                                                                                                                                             
     211                 :         }                                                                                                                                                                                                                                                                                                                                                                                                                                             
     212               0 :         echo "<form action='".PATH_TO_ROOT.SCRIPT_NAME."' method='post'><p class='pForm'>";                                                                                                                                                                                                                                                                                                                                                           
     213               0 :         echo "Teilnehmer des Rollenspiels k&ouml;nnen in der Regel ihre Rolle auch ablegen. ";                                                                                                                                                                                                                                                                                                                                                        
     214               0 :         echo "Mit Auswahl der folgenden Option unterbinden Sie die Auswahlm&ouml;glichkeit <em>keine</em> der Teilnehmer.</p>";                                                                                                                                                                                                                                                                                                                       
     215               0 :         echo "<p><input type='checkbox' id='force' name='force' value='1' ".(RoleSetList::roleplayForced($courseID) ? "checked='checked' " : "") ."/> ";                                                                                                                                                                                                                                                                                              
     216               0 :         echo "<label for='force'>Rolleneinnahme erzwingen</label> ";                                                                                                                                                                                                                                                                                                                                                                                  
     217               0 :         echo "<input type='submit' name='saveForce' value='Speichern' />";                                                                                                                                                                                                                                                                                                                                                                            
     218               0 :         echo "</p></form>";                                                                                                                                                                                                                                                                                                                                                                                                                           
     219               0 :     }                                                                                                                                                                                                                                                                                                                                                                                                                                                 
     220                 : }                                                                                                                                                                                                                                                                                                                                                                                                                                                     

Generated by PHPUnit 3.2.21 and Xdebug 2.0.3 at Thu Nov 26 17:01:15 CET 2009.